﻿<Application
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:local="clr-namespace:PhoneInfo"
   xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
    x:Class="PhoneInfo.App"  
   >

    <!--应用程序资源-->
    <Application.Resources>
        <local:Theme x:Key="Theme"/>
        <Style TargetType="RichTextBox">
            <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}" />
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="RichTextBox">
                        <Grid Background="Transparent">
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource PhoneHorizontalMargin}">
                                <ContentControl x:Name="ContentElement" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Padding="{TemplateBinding Padding}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    	<Style x:Key="ListPickerStyle" TargetType="toolkit:ListPicker">
    		<Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
    		<Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
    		<Setter Property="BorderBrush" Value="{StaticResource PhoneTextBoxBrush}"/>
    		<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
    		<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
    		<Setter Property="HorizontalContentAlignment" Value="Left"/>
    		<Setter Property="Margin" Value="{StaticResource PhoneTouchTargetOverhang}"/>
    		<Setter Property="PickerPageUri" Value="/Microsoft.Phone.Controls.Toolkit;component/ListPicker/ListPickerPage.xaml"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="toolkit:ListPicker">
    					<StackPanel>
    						<VisualStateManager.VisualStateGroups>
    							<VisualStateGroup x:Name="PickerStates">
    								<VisualState x:Name="Normal"/>
    								<VisualState x:Name="Highlighted">
    									<Storyboard>
    										<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
    											<DiscreteObjectKeyFrame KeyTime="0">
    												<DiscreteObjectKeyFrame.Value>
    													<SolidColorBrush Color="Transparent"/>
    												</DiscreteObjectKeyFrame.Value>
    											</DiscreteObjectKeyFrame>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneTextBoxEditBorderBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    									</Storyboard>
    								</VisualState>
    								<VisualState x:Name="Disabled">
    									<Storyboard>
    										<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    										<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Foreground" Storyboard.TargetName="UserControl">
    											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
    										</ObjectAnimationUsingKeyFrames>
    									</Storyboard>
    								</VisualState>
    							</VisualStateGroup>
    						</VisualStateManager.VisualStateGroups>
    						<ContentControl ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0 0 0 8" Foreground="#FF0068B7" FontSize="32"/>
    						<Grid>
    							<Border x:Name="Border" BorderBrush="#00FFFFFF" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
    								<UserControl x:Name="UserControl" Foreground="{TemplateBinding Foreground}">
    									<StackPanel>
    										<TextBlock x:Name="MultipleSelectionModeSummary" Margin="8 8 0 8"/>
    										<Canvas x:Name="ItemsPresenterHost" MinHeight="46">
    											<ItemsPresenter x:Name="ItemsPresenter">
    												<ItemsPresenter.RenderTransform>
    													<TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
    												</ItemsPresenter.RenderTransform>
    											</ItemsPresenter>
    										</Canvas>
    									</StackPanel>
    								</UserControl>
    							</Border>
    						</Grid>
    					</StackPanel>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Style x:Key="ToggleSwitchButtonStyle1" TargetType="toolkitPrimitives:ToggleSwitchButton">
    		<Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
    		<Setter Property="IsTabStop" Value="False"/>
    		<Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="toolkitPrimitives:ToggleSwitchButton">
    					<Border x:Name="Root" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CacheMode="BitmapCache" Opacity="{TemplateBinding Opacity}" Padding="{TemplateBinding Padding}">
    						<VisualStateManager.VisualStateGroups>
    							<VisualStateGroup x:Name="CommonStates">
    								<VisualState x:Name="Normal"/>
    								<VisualState x:Name="Disabled">
    									<Storyboard>
    										<ColorAnimation Duration="0" To="{StaticResource PhoneForegroundColor}" Storyboard.TargetProperty="(Grid.Background).(SolidColorBrush.Color)" Storyboard.TargetName="SwitchBottom"/>
    										<ColorAnimation Duration="0" To="{StaticResource PhoneForegroundColor}" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="ThumbCenter"/>
    										<DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root"/>
    									</Storyboard>
    								</VisualState>
    							</VisualStateGroup>
    							<VisualStateGroup x:Name="CheckStates">
    								<VisualStateGroup.Transitions>
    									<VisualTransition GeneratedDuration="0:0:0.05" To="Unchecked"/>
    									<VisualTransition GeneratedDuration="0:0:0.05" To="Checked"/>
    								</VisualStateGroup.Transitions>
    								<VisualState x:Name="Checked">
    									<Storyboard>
    										<DoubleAnimation Duration="0" To="68" Storyboard.TargetProperty="(TranslateTransform.X)" Storyboard.TargetName="BackgroundTranslation">
    											<DoubleAnimation.EasingFunction>
    												<ExponentialEase EasingMode="EaseOut" Exponent="15"/>
    											</DoubleAnimation.EasingFunction>
    										</DoubleAnimation>
    										<DoubleAnimation Duration="0" To="68" Storyboard.TargetProperty="(TranslateTransform.X)" Storyboard.TargetName="ThumbTranslation">
    											<DoubleAnimation.EasingFunction>
    												<ExponentialEase EasingMode="EaseOut" Exponent="15"/>
    											</DoubleAnimation.EasingFunction>
    										</DoubleAnimation>
    									</Storyboard>
    								</VisualState>
    								<VisualState x:Name="Dragging"/>
    								<VisualState x:Name="Unchecked">
    									<Storyboard>
    										<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(TranslateTransform.X)" Storyboard.TargetName="BackgroundTranslation"/>
    										<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(TranslateTransform.X)" Storyboard.TargetName="ThumbTranslation"/>
    									</Storyboard>
    								</VisualState>
    							</VisualStateGroup>
    						</VisualStateManager.VisualStateGroups>
    						<Grid x:Name="SwitchRoot" Background="Transparent" Height="95" Width="136">
    							<Grid x:Name="SwitchTrack" Width="88">
    								<Grid x:Name="SwitchBottom" Background="{TemplateBinding SwitchForeground}" Height="32">
    									<Rectangle x:Name="SwitchBackground" Fill="{TemplateBinding Background}" HorizontalAlignment="Center" Height="20" VerticalAlignment="Center" Width="76">
    										<Rectangle.RenderTransform>
    											<TranslateTransform x:Name="BackgroundTranslation"/>
    										</Rectangle.RenderTransform>
    									</Rectangle>
    									<Border BorderBrush="{Binding Source={StaticResource Theme}, Path=cuTheme.lexunTBForgetBrush}" BorderThickness="2">
    										<Border BorderBrush="{Binding Source={StaticResource Theme}, Path=cuTheme.lexunTBBackBrush}" BorderThickness="4"/>
    									</Border>
    								</Grid>
    								<Border x:Name="SwitchThumb" BorderBrush="#00ffffff" BorderThickness="4,0" HorizontalAlignment="Left" Height="36" Margin="-4,0" Width="28">
    									<Border.RenderTransform>
    										<TranslateTransform x:Name="ThumbTranslation"/>
    									</Border.RenderTransform>
    									<Border x:Name="ThumbCenter"  BorderBrush="{Binding Source={StaticResource Theme}, Path=cuTheme.lexunTBForgetBrush}" BorderThickness="2" Background="White"/>
    								</Border>
    							</Grid>
    						</Grid>
    					</Border>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Style x:Key="ToggleSwitchStyle" TargetType="toolkit:ToggleSwitch">
    		<Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
    		<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyLight}"/>
    		<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/>
    		<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
    		<Setter Property="IsTabStop" Value="False"/>
    		<Setter Property="HorizontalContentAlignment" Value="Left"/>
    		<Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
    		<Setter Property="VerticalContentAlignment" Value="Top"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="toolkit:ToggleSwitch">
    					<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CacheMode="BitmapCache" Padding="{TemplateBinding Padding}">
    						<VisualStateManager.VisualStateGroups>
    							<VisualStateGroup x:Name="CommonStates">
    								<VisualState x:Name="Normal"/>
    								<VisualState x:Name="Disabled">
    									<Storyboard>
    										<DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Header"/>
    										<DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
    									</Storyboard>
    								</VisualState>
    							</VisualStateGroup>
    						</VisualStateManager.VisualStateGroups>
    						<Grid Margin="0,0,36,0">
    							<Grid.ColumnDefinitions>
    								<ColumnDefinition Width="*"/>
    								<ColumnDefinition Width="Auto"/>
    							</Grid.ColumnDefinitions>
    							<Grid.RowDefinitions>
    								<RowDefinition Height="Auto"/>
    								<RowDefinition Height="Auto"/>
    							</Grid.RowDefinitions>
    							<ContentControl x:Name="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="#0068b7" FontSize="32" FontFamily="{StaticResource PhoneFontFamilyNormal}" HorizontalAlignment="Left" IsTabStop="False" Margin="-1,0,0,0" Opacity="{TemplateBinding Opacity}" VerticalAlignment="Bottom"/>
    							<ContentControl x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="False" Margin="-1,10,0,-7" Opacity="{TemplateBinding Opacity}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="#FF7D7D7D"/>
    							<toolkitPrimitives:ToggleSwitchButton x:Name="Switch" Background="{TemplateBinding Background}" Grid.Column="1" Margin="-22,-29,-24,-28" Opacity="{TemplateBinding Opacity}" Grid.RowSpan="2" SwitchForeground="{TemplateBinding SwitchForeground}" VerticalAlignment="Bottom" Style="{StaticResource ToggleSwitchButtonStyle1}"/>
    						</Grid>
    					</Border>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
        <Style x:Key="TransitionPageStyle" TargetType="phone:PhoneApplicationPage">
            <Setter Property="toolkit:TransitionService.NavigationInTransition">
                <Setter.Value>
                    <toolkit:NavigationInTransition>
                        <toolkit:NavigationInTransition.Backward>
                            <toolkit:TurnstileTransition Mode="BackwardIn"/>
                        </toolkit:NavigationInTransition.Backward>
                        <toolkit:NavigationInTransition.Forward>
                            <toolkit:TurnstileTransition Mode="ForwardIn"/>
                        </toolkit:NavigationInTransition.Forward>
                    </toolkit:NavigationInTransition>
                </Setter.Value>
            </Setter>
            <Setter Property="toolkit:TransitionService.NavigationOutTransition">
                <Setter.Value>
                    <toolkit:NavigationOutTransition>
                        <toolkit:NavigationOutTransition.Backward>
                            <toolkit:TurnstileTransition Mode="BackwardOut"/>
                        </toolkit:NavigationOutTransition.Backward>
                        <toolkit:NavigationOutTransition.Forward>
                            <toolkit:TurnstileTransition Mode="ForwardOut"/>
                        </toolkit:NavigationOutTransition.Forward>
                    </toolkit:NavigationOutTransition>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
    <Application.ApplicationLifetimeObjects>
        <!--处理应用程序的生存期事件所需的对象-->
        <shell:PhoneApplicationService 
            Launching="Application_Launching" Closing="Application_Closing" 
            Activated="Application_Activated" Deactivated="Application_Deactivated"/>
    </Application.ApplicationLifetimeObjects>

</Application>